import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:flutter/material.dart';

// blue  radius 24
// white border 2  white
class NormalButton extends StatelessWidget {
  final String title;
  final VoidCallback onTap;
  final Widget leading;
  final bool isBorder;

  const NormalButton(
      {Key key, this.leading, this.isBorder = false, this.title, this.onTap})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    final text = Text(
      title,
      style: TextStyle(
        color: isBorder ? aceBlueColor : Colors.white,
        fontSize: getSp(16),
        fontWeight: FontWeight.w700,
        height: 20 / 16,
      ),
    );
    return Center(
      child: PressedOpacityButton(
        onPressed: onTap,
        disabledColor: aceGrayColor,
        color: isBorder ? Colors.white : aceBlueColor,
        border: isBorder
            ? Border.all(
                color: aceBlueColor,
                width: getDp(2),
              )
            : Border(),
        borderRadius: BorderRadius.circular(getDp(24)),
        child: Container(
          height: getDp(48),
          width: getDp(250),
          alignment: Alignment.center,
          child: leading != null
              ? Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    leading,
                    SizedBox(
                      width: getDp(16),
                    ),
                    text,
                  ],
                )
              : text,
        ),
      ),
    );
  }
}
